{{extend './pub/index.html'}}

{{ block 'main'}}
<div class="container">
  <div class="text-center" style="font-size: 26px;border-bottom: 2px solid rgb(153, 148, 148);padding-bottom: 5px;">{{if name}}校园新闻{{else}}校园公告{{/if}}
  </div>
  <div style="text-align: center;">
    <h1 style="font-size: 30px;margin: 10px;">{{data.Title}}</h1>
    <span style="margin: 5px 0px;font-size: 15px;">日期：{{date}}</span>
  </div>
  <div id="text" style="padding-bottom: 100px;border-bottom: 1px solid rgb(153, 148, 148);min-height: 400px;">{{@ data.Content}}</div>

  {{if name}}
  <div style="margin-top: 80px;">
    {{if msg }}
    <form action="/home/comment" method="POST">
      <div class="form-group">
        <label for="exampleFormControlTextarea1">留下你的评论吧 ：</label>
        <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" name="Content"></textarea>
      </div>
      <input type="hidden" id="ip" name="ip">
      <input type="hidden" id="id" value="{{data.id}}" name="Newsid">
      <div class="text-right">
        <input type="submit" class="btn btn-secondary btn-sm" value="提交评论">
      </div>

    </form>
    {{ else}}
    登录可进行评论
    {{/if}}
  {{else}}

  {{/if}}

  </div>
  <div style="margin: 20px 0px;padding: 0px 20px;">
    {{each commit}}
    <div style="border-bottom:1px soild block;margin: 30px 0px;">
      <div style="display: flex;height: 50px;align-items: center;">
        <div style="height: 50px;width: 50px;background-color: rgba(42, 42, 42, 0.205);border-radius: 50%;"></div>
        <div style="margin-left: 10px;">
          <div style="font-size: 17px;line-height: 13px;color: #404040;">{{$value.Author}}</div>
          <div style="font-size: 12px;color: #969696;">{{$value.leavedate}}</div>
        </div>
      </div>
      <div style="margin-top: 5px;font-size: 14px;margin-left: 60px;">
        {{$value.Content}}
      </div>
    </div>
    {{/each}}
  </div>
</div>
{{/block}}

{{ block 'script'}}
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script>
  let ip = returnCitySN["cip"]
  $('#ip').val(ip)
</script>
{{ /block }}